//写一函数，使给定的一个二维数组3x3转置。

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int zz(int a[3][3])
{
	int i,j,temp;
	for (i=0;i<3;i++)
		for (j=i+1;j<3;j++)
		{
			temp=a[i][j];
			a[i][j]=a[j][i];
			a[j][i]=temp;
		}
}

int main()
{
	int i,j,a[3][3];
	srand(time(NULL));
	for (i=0;i<3;i++)
	{
		for (j=0;j<3;j++)
		{
                        a[i][j] = rand()%100;
			printf("%2d ",a[i][j]);
		}
		printf("\n");
	}
	printf("=========================\n");

	zz(a);
	for (i=0;i<3;i++)
        {
                for (j=0;j<3;j++)
                {
                        printf("%2d ",a[i][j]);
                }
                printf("\n");
        }
	
	return 0 ;
}



//diwutiantang@diwutiantang-VirtualBox:~/snap/lc/Dec/1219/zuoye$ ./4
//27 29 82
//57 89 82
//26 53 76
//=========================
//27 57 26
//29 89 53
//82 82 76

